package com.accesshollywood.viewFiltering;

import java.util.LinkedHashSet;

public class ViewFilterGroup {
	public String								groupName;
	public LinkedHashSet<ViewFilterTemplate>	filters;

	public ViewFilterGroup(String name){
		this.groupName = name;
		filters = new LinkedHashSet<ViewFilterTemplate>();
	}
	
	public void add(ViewFilterTemplate newFilter){
		filters.add(newFilter);
		newFilter.viewFilterGroup = this;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((filters == null) ? 0 : filters.hashCode());
		result = prime * result + ((groupName == null) ? 0 : groupName.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		ViewFilterGroup other = (ViewFilterGroup) obj;
		if (filters == null) {
			if (other.filters != null)
				return false;
		} else if (!filters.equals(other.filters))
			return false;
		if (groupName == null) {
			if (other.groupName != null)
				return false;
		} else if (!groupName.equals(other.groupName))
			return false;
		return true;
	}
}
